﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TeamOPSchoolCup.Domain.POCO.Members;
using TeamOPSchoolCup.Domain.DTO;
using TeamOPSchoolCup.Domain.POCO.Ranking;

namespace TeamOPSchoolCup.Domain.POCO
{
  public class Team
  {
    public int TeamId { get; set; }
    public string Name { get; set; }
    public string Photo { get; set; }
    public string Logo { get; set; }
    public short Gender_Value { get; set; }
    public bool IsParticipating { get; set; } //This should be set to false every year

    public int CoachId { get; set; }
    public int SportId { get; set; }
    //public int SchoolId { get; set }

    public virtual List<TeamMembership> TeamMemberships { get; set; }
    public virtual Coach Coach { get; set; }
    public virtual Sport Sport { get; set; }
    //public virtual School School { get; set; }
    //public virtual List<Meeting> Meetings { get; set; }
    public virtual List<TeamResult> TeamResults { get; set; }

    public Gender Gender
    {
      get { return (Gender)Gender_Value; }
      set { Gender_Value = (short)value; }
    }

    //Demo implementation of equals and hashcode
    public override bool Equals(object obj)
    {
      if (obj == null || GetType() != obj.GetType()) return false;
      return (this.TeamId == ((Team)obj).TeamId);
    }

    public override int GetHashCode() { return this.TeamId; }
  }
}
